<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditPropertyTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditPropertyLabel_idProperty}" for="idProperty" />
                    <h:inputText id="idProperty" value="#{propertyController.selected.idProperty}" title="#{bundle.EditPropertyTitle_idProperty}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_idProperty}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_address}" for="address" />
                    <h:inputText id="address" value="#{propertyController.selected.address}" title="#{bundle.EditPropertyTitle_address}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_address}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_address2}" for="address2" />
                    <h:inputText id="address2" value="#{propertyController.selected.address2}" title="#{bundle.EditPropertyTitle_address2}" />
                    <h:outputLabel value="#{bundle.EditPropertyLabel_postcode}" for="postcode" />
                    <h:inputText id="postcode" value="#{propertyController.selected.postcode}" title="#{bundle.EditPropertyTitle_postcode}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_postcode}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_numberBedroom}" for="numberBedroom" />
                    <h:inputText id="numberBedroom" value="#{propertyController.selected.numberBedroom}" title="#{bundle.EditPropertyTitle_numberBedroom}" />
                    <h:outputLabel value="#{bundle.EditPropertyLabel_numberBathroom}" for="numberBathroom" />
                    <h:inputText id="numberBathroom" value="#{propertyController.selected.numberBathroom}" title="#{bundle.EditPropertyTitle_numberBathroom}" />
                    <h:outputLabel value="#{bundle.EditPropertyLabel_garden}" for="garden" />
                    <h:inputText id="garden" value="#{propertyController.selected.garden}" title="#{bundle.EditPropertyTitle_garden}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_garden}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_furniture}" for="furniture" />
                    <h:inputText id="furniture" value="#{propertyController.selected.furniture}" title="#{bundle.EditPropertyTitle_furniture}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_furniture}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_sizeSquareMetre}" for="sizeSquareMetre" />
                    <h:inputText id="sizeSquareMetre" value="#{propertyController.selected.sizeSquareMetre}" title="#{bundle.EditPropertyTitle_sizeSquareMetre}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_sizeSquareMetre}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_description}" for="description" />
                    <h:inputText id="description" value="#{propertyController.selected.description}" title="#{bundle.EditPropertyTitle_description}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_description}"/>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_ownerUsername}" for="ownerUsername" />
                    <h:selectOneMenu id="ownerUsername" value="#{propertyController.selected.ownerUsername}" title="#{bundle.EditPropertyTitle_ownerUsername}" required="true" requiredMessage="#{bundle.EditPropertyRequiredMessage_ownerUsername}">
                        <f:selectItems value="#{ownerController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.EditPropertyLabel_agentUsername}" for="agentUsername" />
                    <h:selectOneMenu id="agentUsername" value="#{propertyController.selected.agentUsername}" title="#{bundle.EditPropertyTitle_agentUsername}" >
                        <f:selectItems value="#{agentController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <h:commandLink action="#{propertyController.update}" value="#{bundle.EditPropertySaveLink}"/>
                <br />
                <br />
                <h:commandLink action="View" value="#{bundle.EditPropertyViewLink}" immediate="true"/>
                <br />
                <h:commandLink action="#{propertyController.prepareList}" value="#{bundle.EditPropertyShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.EditPropertyIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
